package controller.teacher.manager;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import view.DataList;

import dao.Student;

@WebServlet("/teacher/manager/del")
public class del extends Base {
    private static final long serialVersionUID = 1L;

    public del() {
        super();
    }

    protected void doGet(HttpServletRequest request,
            HttpServletResponse response)
        throws ServletException, IOException {
        try {
            Student.deleteById(new Integer(request.getParameter("id")));
            view.sendRedirect(
                    request.getContextPath() + "/teacher/manager/index");
        } catch (NumberFormatException | SQLException e) {
            e.printStackTrace();
        }
    }

    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}
